//
//  BBOnePictureCell.swift
//  BaoKanSwift
//
//  Created by uncle-R on 16/6/13.
//  Copyright © 2016年 uncle-R. All rights reserved.
//

import UIKit
import SDWebImage

class BBOnePictureCell: UITableViewCell {
    

    @IBOutlet weak var title: UILabel!
    
    @IBOutlet weak var pictrue: UIImageView!
    
    @IBOutlet weak var time: UILabel!
    
    @IBOutlet weak var comment: UILabel!
    
    @IBOutlet weak var looked: UILabel!
    

    var model:BBNewsModel? {
        didSet{
            self.pictrue.image = nil
            self.pictrue.sd_setImageWithURL(NSURL(string: model!.titlepic!), placeholderImage: UIImage(named: "placeholder_logo.png"))
            self.title.text = model!.title
            self.time.text = model!.newstime
            self.comment.text = model!.plnum
            self.looked.text = model!.onclick!
        }
    }
    
    func getRowHeight(model: BBNewsModel) -> CGFloat {
        layoutIfNeeded() //更新约束
        model.rowHeight = CGRectGetMaxY(time.frame) + 15
        return model.rowHeight
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectionStyle = UITableViewCellSelectionStyle.None
    }

    
}
